﻿<?php
@session_start();

require_once("../../class/mysql.class.php");
  $obj = new Mysql();
  $obj -> set_table('user_login');
  $obj -> set_colone("(`*`)");
  $obj -> set_variables(" id_login = '" . $_SESSION["id"] . "' ");
  $user = $obj -> select_enregistrement();
 // echo $user['id_login'];
  
if (isset($_REQUEST['type_mon']))
{
	$type_monnai = addslashes($_REQUEST["type_mon"]); 
	$desc= addslashes($_REQUEST["desc_monnaie"]); 
	$req="SELECT * FROM `st_att_monnaie` WHERE nom_monnaie='".$type_monnai."'";
	$num=mysql_num_rows(mysql_query($req));
	if($num<1){
		$sql = "INSERT INTO `st_att_monnaie` (`id_monnaie`, `nom_monnaie`,`description`) 
		VALUES 
		('', '".$type_monnai."', '".$desc."');";
		mysql_query($sql);
		header('location:../../list_monnaie.php?action=added&devise='.$type_monnai);
	}else{
		header('location:../../list_monnaie.php?action=addedError&devise='.$type_monnai);
	}
}
